package com.share.barter.action;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.opensymphony.xwork2.ActionContext;
import com.share.barter.common.BaseAction;
import com.share.barter.data.pojo.Acount;
import com.share.barter.data.services.AcountService;


/**
 * 登录
 * @author  Tumi
 * 日期：2012-10-8
 */
public class AcountLogin extends BaseAction{
	
	@Autowired	AcountService acountService;
	
	private static final long	serialVersionUID	= 1L;

	private String username;
	private String password;
	
		/**
		 * 用户登录
		 * TODO
		 * @param username
		 * @param password
		 * @return
		 */
	
	 public String login(String username,String password ){
		 String result = "error";
		 try{
			 //登录验证
			Acount at= acountService.acountLogin( username, password );
			result = "success";
		}
			catch( Exception e ){
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			return result;
	}

	 /**
	  * 注册
	  * TODO
	  * @param acount
	  * @return
	  */
	 public String register(Acount acount){
		 String result ="error";
		 try{
			 //保存注册信息
			 //acountService.save(account);
			 
			 }catch(Exception e){
				 e.printStackTrace();
				 return result;
			 }
			 
		 return result;
	 }
	 
	 
	
	 /**
		 * @return the username
		 */
		public String getUsername()
		{
			return username;
		}

		/**
		 * @return the password
		 */
		public String getPassword()
		{
			return password;
		}
}
